package com.tbit.uqbike.client.util;

import com.tbit.uqbike.client.constant.MapConstant;
import com.tbit.uqbike.client.service.GeoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: chen
 * @Description:
 * @Date: 创建于 10:30 2020/1/6
 */
@Component
public class AgentCheckUtil {

    @Autowired
    private GeoService geoService;

    public Integer check(Integer accountId, Double lo, Double la, Integer mapType) {
        Assert.notNull(accountId, "-10001", "品牌id不能为空");
        Assert.notNull(lo, "-2001", "经度不能为空");
        Assert.notNull(la, "-2002", "纬度不能为空");

        if (mapType == null) {
            mapType = MapConstant.MAP_GOOGLE;
        }

        Integer agentId = geoService.getBelongAccount(accountId, lo, la, mapType);
        return agentId;
    }

}
